package com.eee.xiang.market.dao.mapper;

import com.eee.xiang.market.beans.TUser;
import com.eee.xiang.market.beans.TUserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface TUserMapper {
    long countByExample(TUserExample example);

    int deleteByExample(TUserExample example);

    int deleteByPrimaryKey(String userId);

    int insert(TUser record);

    int insertSelective(TUser record);

    List<TUser> selectByExample(TUserExample example);

    TUser selectByPrimaryKey(String userId);

    int updateByExampleSelective(@Param("record") TUser record, @Param("example") TUserExample example);

    int updateByExample(@Param("record") TUser record, @Param("example") TUserExample example);

    int updateByPrimaryKeySelective(TUser record);

    int updateByPrimaryKey(TUser record);

    @Update("update t_user set password = #{password} where user_id = #{userId} ")
    int changePWD(TUser user);

    @Select("<script>" +
            "select * from t_user" +
            " where 1 = 1" +
            "<if test='userId!=null'>" +
            "  and user_id = #{userId}" +
            "</if>" +
            "<if test='userName != null'>" +
            " and user_name like '%${userName}%'" +
            "</if>" +
            "<if test='deleteFlag!=null'>" +
            " and delete_flag = #{deleteFlag}" +
            "</if>" +
            " order by create_datetime desc"+
            "</script>")
    @ResultMap(value = "com.eee.xiang.market.dao.mapper.TUserMapper.BaseResultMap")
    List<TUser> selectUserListByPage(TUser userForm);
}